<template>
	<view class="content">
		<scroll-view scroll-y="true" class="scroll-Y" :refresher-enabled="isrefresher" refresher-threshold = 20
		ref="scrollView"
		:show-scrollbar="true" 
		scroll-into-view="buttom"
		enable-back-to-top="top"
		@scroll = "scrollAuto"
		@refresherrefresh="refresh">
			<view id="demo1" class="scroll-view-item uni-bg-red">A</view>
			<view id="demo2" class="scroll-view-item uni-bg-green">B</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="demo2" class="scroll-view-item uni-bg-green">B</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="demo3" class="scroll-view-item uni-bg-blue">C</view>
			<view id="buttom"></view>
		</scroll-view>
		<view class="floor">
			<view class="text_input">
				<input v-model="value" style="background-color: white; flex:1;height: 80rpx;border-radius: 10rpx;padding-left: 10rpx;" />
				<button type="primary" text="发送" style="margin-left: 10rpx;" @click="submit">发送</button>
			</view>
		</view>
	</view>
</template>

<script>
	import api from "@/until/api.js"
	export default {
		data() {
			return {
				isrefresher : true,
				value:""
			}
		},
		onLoad() {
			uni.$once('update',(res=>{
				
			}))
		},
		methods: {
			refresh(){
				setTimeout(()=>{
					this.isrefresher = false
				},2000)
			},
			scrollAuto(){
				this.isrefresher = true
			},
			submit(){
				console.log(this.value)
				this.value = ""
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		margin: 0px auto;
		height: 100vh;
		.scroll-Y{
			width: 95%;
			height: 92%;
			margin: 0px auto;
		}
		.floor{
			width: 100%;
			background-color: #F4F4F4;
			height: 5%;
			.text_input{
				width: 95%;
				margin: 0px auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
				input{
					margin: 10rpx 0;
				}
			}
		}
	}
	
	.scroll-view-item {
		height: 300rpx;
		line-height: 300rpx;
		text-align: center;
		font-size: 36rpx;
	}
</style>
